package com.ugoodtech.mdcc.web.controller;

import com.ugoodtech.mdcc.core.domain.User;
import com.ugoodtech.mdcc.web.dto.JsonResponse;
import com.ugoodtech.mdcc.web.service.FeedBackService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@Api(description = "意见管理相关接口")
@Controller
@RequestMapping("/FeedBackController")
public class FeedBackController extends BaseController {

    @Autowired
    private FeedBackService feedBackService;

    @ApiOperation("意见管理-获得所有/条件搜索")
    @ApiResponses({
            @ApiResponse(code = 200, message = "data", response = User.class)
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页数", required = false, paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "size", value = "每页条数", required = false, paramType = "query", dataType = "int"),
    })
    @RequestMapping(value = "/getAllFeedBack", method = RequestMethod.GET)
    @ResponseBody
    public JsonResponse getAllFeedBack(@ApiParam("用户ID") @RequestParam(value = "userId", required = false) Long userId,
                                       @ApiParam("姓名") @RequestParam(value = "username", required = false) String username,
                                       @ApiParam("意见内容") @RequestParam(value = "description", required = false) String suggestion,
                                       Pageable pageable) {
        isUserLogin();
        return feedBackService.getAllFeedBack(userId, username, suggestion, pageable);
    }

}
